package com.tinyseed.hmxx.admin.security.utils;

import com.tinyseed.hmxx.admin.system.domain.Role;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * @version Revision 1.0.0
 * @版权：
 * @author: Howard
 * @email:
 * @see:
 * @创建日期：2020/2/19
 * @功能说明：
 * @begin
 * @修改记录:
 * @修改后版本 修改人        修改内容
 * @2020/2/19 wuxiran        创建
 * @end
 */

public class JwtUserFactory {

    private JwtUserFactory() {

    }

    private static List<GrantedAuthority> map2GrantedAuthorities(Set<Role> authories) {
        return authories.stream()
                .map(Role::getName)
                .map(SimpleGrantedAuthority::new)
                .collect(Collectors.toList());
    }

}
